package com.victualler.core.config.dict.repository;

import com.victualler.core.base.repository.BaseRepository;
import com.victualler.core.config.dict.entity.DictDao;
import com.victualler.core.config.dict.dto.*;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Author: Guoshichang
 * @Date: Create in 13:15 2018/4/5
 * @Discription:
 */
@Repository
public interface DictRepository extends BaseRepository<DictDao,Long> {
    @Query("select new com.victualler.core.config.dict.dto.DictTopDto(di.codeType,di.typeName,count(di.id)) from DictDao  di group by di.codeType,di.typeName")
    public List<DictTopDto>  findDictTopList();

    public List<DictDao>  findByCodeType(String codeType);

    public DictDao findByCodeTypeAndCodeCode(String codeType,String codeCode);
}
